<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
 
<title>用户登录页面</title>

<link rel="stylesheet" href="css/login.css" type="text/css" />
<script type="text/javascript"> 
	var userID_OK = false;
	var password_OK = false;
	var code_OK = false;
	function checkUserID(u){
		var userID = u.value;
		if(userID!=null&&userID.length>0){
			userID_OK = true;
		}else{
			userID_OK = false;
		}
	}
	
	function checkPassword(pw){
		var password = pw.value;
		if(password!=null&&password.length>0){
			password_OK = true;
		}else{
			password_OK = false;
		}
	}
	
	function checkCode(c){
		var code = c.value;
		if(code!=null&&code.length>0){
			code_OK = true;
		}else{
			code_OK = false;
		}
	}
	
	function check(){
		if(!userID_OK){
			alert("请输入用户名");
			document.getElementById("userID").focus();
			return false;
		}
		if(!password_OK){	
			alert("请输入用户密码");
			document.getElementById("password").focus();
			return false;
		}
		if(!code_OK){	
			alert("请输入验证码");
			document.getElementById("checkcode").focus();
			return false;
		}
	}
</script>

</head>
<body style="background-color:#ffffff;">
<div align="center">
<div class="main" > 
  <div class="big">
    <div class="left">
      <div class="tbg" style="margin-top:100px;">
			<img src="images/login_07.gif" width="371" height="7" alt="" /></div>
      <div class="mbg">
        <div class="login">
			<div class="top"> 
				<span class="left">
					<img src="images/login_15.gif" width="152" height="22" alt="用户登录" />
				</span> 
			</div>
          <div class="form">
            <div class="hiddendiv">
              <div style="display: none;"> 
              </div>
            </div>
            <form id="loginForm" method="post" action="loginUser.action" onsubmit="return check()">
            	 
              <div class="user"> <span class="text">用户ID：</span>
                <input name="user.userID" type="text" id="userID" value="" class="input" tabindex="1" onblur="checkUserID(this)"/>
                <script type="text/javascript">document.getElementById('str_username').focus();</script>
              </div>
              <div class="user"> <span class="text">密 码：</span>
                <input name="user.password" type="password" id="password" class="input"  tabindex="1"  onblur="checkPassword(this)"/>
              </div>
              <div class="user"> 
	              	<span class="text">验证码：</span>  
	                	 <input type="text" class="inputCode" name="checkcode"  id="checkcode"  tabindex="1" size="6" maxlength="6" title="在这儿输入验证码，不区分大小写！" onblur="checkCode(this)"/>
	                	 <span class="img">
	                	 	<img src="rand.action" id="randImg" title="点击图片刷新验证码" onclick="changeValidateCode(this)" height="25" width="80" />
	                	 </span> 
				     <script type="text/javascript"> 
						function changeValidateCode(obj) { 
						//获取当前的时间作为参数，无具体意义 
							var timenow = new Date().getTime(); 
						//每次请求需要一个不同的参数，否则可能会返回同样的验证码 
						//这和浏览器的缓存机制有关系，也可以把页面设置为不缓存，这样就不用这个参数了。 
							obj.src="rand.action?d="+timenow; 
						} 
						function changeCodeImg(){
							var img = document.getElementById("randImg"); 
							var timenow = new Date().getTime(); 
							img.src = "rand.action?d="+timenow; 
						}
					 </script> 
               </div>
             
              <div class="user1">
                <input type="checkbox" name="rememberme" checked="checked" id="rememberme" class="check" />
                <span class="font12">记住我的用户名</span> </div>
              <div class="user2">
                <input id="btnSubmit" tabindex="1" type="submit" name="Submit1" value="用户登录" class="submit" onclick="return loginSubmit()" />
                	<span class="fonth">
                		<a href="#">忘记密码？</a>
                	</span> 
                </div>
            </form>
          </div>
        </div>
        <div class="bg1"> 
          <div id="errorInfo"> 
          		<s:actionerror/>
          </div>
        </div>
        
        <div class="bg2"  >
          <div class="login-w"> 您还没有注册用户？</div>
          <div class="floatl "> 
          		<a href="register.jsp" > 
          			<img src="images/login_08.gif" alt="注册" width="100" height="25" align="middle" />
          		</a>
          	</div>
        </div>
      </div>
      <div class="fbg"> </div>
    </div> 
   </div>
   </div>
</div>
</body>
</html>
